<?php
/**
 * Created by PhpStorm.
 * User: lyh
 * Date: 2017/8/12
 * Time: 15:02
 */
namespace App\Http\ViewComposers;
use App\Http\Model\Article;
use App\Repositories\SearchRepository;
use App\Repositories\UserRepository;
use Illuminate\View\View;

class SearchComposer{

    /**
     * 用户仓库实现.
     *
     * @var UserRepository
     */
    protected $search;

    /**
     * 创建一个新的属性composer.
     *
     * @param UserRepository $users
     * @return void
     */
    public function __construct(SearchRepository $search)
    {
        // Dependencies automatically resolved by service container...
        $this->search = $search;
    }

    /**
     * 绑定数据到视图.
     *
     * @param View $view
     * @return void
     */
    public function compose(View $view)
    {
        $arr=$this->search->getSearchHot('4');

        $view->with('searchHot',$arr);
    }
}